﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using System.Dynamic;
using NUnit.Framework;
using System.Reflection;
using CERT.AcceptanceTests.InterfaceTests.DefaultValues;


namespace CERT.AcceptanceTests
{

    //http://blogs.lessthandot.com/index.php/EnterpriseDev/application-lifecycle-management/using-specflow-to   


    class Settings
    {
        public string BaseUrl { get; private set; }
        public string FirefoxBinaryPath { get; set; }

        public DefaultValues Defaults { get; set; }

        private static Settings _settings;
        public static Settings CurrentSettings
        {
            get
            {
                if (_settings == null)
                {
                    LoadSettings("TestRun.config");
                }
                return _settings;
            }
        }

        private Settings(string url, string fb)
        {
            BaseUrl = url;
            FirefoxBinaryPath = fb;
        }

        private static void LoadSettings(String file)
        {
            XElement settingsFile = XElement.Load(file);
            string url = settingsFile.Element("URL").Value;
           string fb = settingsFile.Element("FirefoxBinaryPath").Value;
            _settings = new Settings(url,fb);


        }
    }
}
